<?php
include "../../../lib/list.php";
if ($b_no = $_GET['b_no']){
	$sear_char .= " and b_no = $b_no";
}
if ($m_no = $_GET['m_no']){
	$sear_char .= " and m_no = $m_no";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head>
<link rel="stylesheet" href="../../../css/list.css" type="text/css"/>
<link rel="stylesheet" href="../../../css/table.blue.sorter.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="../../../css/jquery.tablesorter.pager.css" type="text/css" media="print, projection, screen" />
<script type="text/javascript" src="../../../js/jquery-1.2.6.js"></script>
<script type="text/javascript" src="../../../js/jquery.tablesorter.pager.js"></script>
<script type="text/javascript" src="../../../js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="../../../js/list.js"></script>
<script type="text/javascript">
	$(function(){
		$("table")
			.tablesorter({headers: {             
     		    0: {               
        		     // 정렬선택 안함
        		     sorter: false         
        		    }         
        		   },widthFixed: true, widgets: ['zebra'] })
			.tablesorterPager({container: $("#pager")});
	});
	</script>
</head>
<body>
	<div style="width:1024px;padding:10px;">
	<div style="border-bottom:1px solid #e8e8e8; text-align:left; font-size:12px; margin-bottom:12px; color:#9a9a9a">::: 마스터 관리&nbsp;⇒&nbsp;소분류 마스터</div>
	<div style="float:left;padding-right:7px;"><?echo c_big($b_no)?></div>
	<div style="float:left;"><?echo c_middle($b_no,$m_no)?></div>
	<div style="float:right;padding:5px;">
	<input type="button" class="button red small" value="삭제하기 " onclick="javascript:list_delete();"/>
	<input type="button" class="button green small"	value="수정하기" onclick="javascript:list_modify();"/> 
	<input type="button" class="button white small"	value="입력하기"  onclick="javascript:location.href='insert.php'"/>
	</div>
	<form name="view" method="post">
	<input type="hidden" value="" name="mode"/>
	<input type="hidden" value="" name="b_no"/>
		<table cellspacing="1" class="tablesorter">
			<thead>
				<tr>
					<th width="10px"><input
									onclick="if (this.checked) all_checked(true); else all_checked(false);"
									type=checkbox tabindex=1 />
								</th>
								<th width="30px">no</th>
								<th>대분류 명</th>
								<th>중분류 명</th>
								<th>소분류 명</th>
								<th>총상품 수</th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<th width="10px">&nbsp;
						</th>
								<th width="30px">no</th>
								<th>대분류 명</th>
								<th>중분류 명</th>
								<th>소분류 명</th>
								<th>총상품 수</th>
				</tr>
			</tfoot>
			<tbody>
						<?php
						$query = "select * from uatp_smallcategory where 1 $sear_char order by no DESC ";
						$total = DBnumrows($query);
						$result = DBquery($query);
						for($i=1; $list = mysql_fetch_array($result); $i++){
							$bunho = $total - $i + 1;
							$qry = "select * from uatp_biggestcategory where no = ".$list['b_no'];
							$b_no = DBarray($qry);
							$m_qry = "select * from uatp_middlecategory where no = ".$list['m_no'];
							$m_no = DBarray($m_qry);
														?>
							<tr onclick="javascript:chk(<?=$list['no']?>)">
								<td><input type=checkbox name=chk_no[]
									value="<?=$list['no']?>" onclick="javascript:chk(<?=$list['no']?>)"></input></td>
								<td align=center><?=$bunho?></td>
								<td><?=$b_no['name']?></td>
								<td><?=$m_no['name']?></td>
								<td><b><?=$list['name']?></b></td>
								<td><?
								$sql = "select * from uatp_product where s_no = ".$list['no']." order by no DESC";
								echo DBnumrows($sql);
								?>&nbsp;개</td>
							</tr>							
<?php 
}
	mysql_free_result($result);
?>
			</tbody>
		</table>
		</form>
		
		<div id="pager" class="pager">
			<form>
				<img src="../../../image/first.png" class="first" /> <img
					src="../../../image/prev.png" class="prev" /> <input
					type="text" class="pagedisplay" /> <img
					src="../../../image/next.png" class="next" /> <img
					src="../../../image/last.png" class="last" /> <select
					class="pagesize">
					<option selected="selected" value="10">10</option>
					<option value="20">20</option>
					<option value="30">30</option>
					<option value="40">40</option>
				</select>
			</form>
				</div>
					
	</div>
</body>
</html>